1. Field of the Invention
The present invention relates to an electronic device including a magnetic sensor for detecting geomagnetism, sensor calibration method for the magnetic sensor applicable to the electronic device, and a storage medium.
2. Description of the Related Art
In recent years, in the field of portable (or mountable) electronic devices such as portable telephones, smartphones (high-functionality portable telephones), navigation terminals, and sports watches, various services using position information and map information have been provided.
These electronic devices generally include a magnetic sensor (also called an electronic compass), in which a method of measuring an azimuth based on geomagnetism detected by the magnetic sensor has been adopted.
Also, these electronic devices are mounted with a loudspeaker and various electronic components in addition to the magnetic sensor. Accordingly, magnetism emitted from the loudspeaker, magnetism leaking from a metal package of a magnetized electronic component, and the like may be present near the magnetic sensor. Moreover, a strong magnetic field may be present around the electronic device. In this case, the magnetic sensor mounted on the electronic device may be magnetized by receiving magnetism from an electronic component inside the electronic device and a magnetic field around the electronic device.
When the magnetic sensor is magnetized, detection results of the magnetic sensor include an effect by this magnetization in addition to geomagnetism that is an original detection target. In this case, an azimuth calculated based on the measurement value of the geomagnetism detected by the magnetic sensor is different from the accurate azimuth. Accordingly, calibration processing for correcting the error (=offset) of the azimuth due to the magnetization of the magnetic sensor is required to be performed on the magnetic sensor.
For example, Japanese Patent No. 4391416 discloses, as an offset correction method by calibration processing on a magnetic sensor, a method using the fact that magnetic data acquired by arbitrarily changing the direction of a magnetic sensor for detecting geomagnetism in three axis directions is distributed over a spherical plane, in which the center coordinates of a specific sphere whose spherical plane is positioned near each point of a magnetic data group acquired by the magnetic sensor are estimated by using a statistical scheme and an offset value is calculated based on the center coordinates.
In this offset value calculation method, it is required to arbitrarily change the direction of the magnetic sensor during a period of acquiring magnetic data. However, if the direction of the magnetic sensor is not arbitrarily changed and the direction of the magnetic sensor is changed with its orientation with respect to a specific axis (for example, a coordinate axis in a gravity direction) is kept constant, the acquired magnetic data concentrates in a specific plane.
Therefore, in this case, solutions by statistical schemes are not computable, or a calculation error is significantly large, which possibly results in an erroneous solution (center coordinates and offset value).
Moreover, when calibration processing is to be performed on the magnetic sensor, the user (device user) is required to perform a motion of changing the direction of an electronic device having the magnetic sensor, a specific operation, and the like, as described in Japanese Patent No. 4391416. Such motion and operation are burdensome to the user, and therefore put a load on the user.